<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateAdminRoleMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('admin_role_menus')) {
            Schema::create('admin_role_menus', function (Blueprint $table) {
                $table->id();
                $table->string('role_name');
                $table->text('rules')->nullable()->comment('菜单id:admin_menus.id,多个id用英文逗号分割,超管值为*');
                $table->timestamps();
            });
            DB::statement("ALTER TABLE `admin_role_menus` comment '角色菜单表'");
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_role_menus');
    }
}
